using SMGCore.EventSys;
using Game.Networking.Events;
using Game.Networking.Server;

using MemoryPack;

namespace Game.Networking {
	public class C_ChatMessageHandler : BaseClientMessageHandler {
		public override ClientPacketID CommandId {
			get {
				return ClientPacketID.ChatMessage;
			}
		}
		public override void ProcessMessage(ClientState client, byte[] rawCommand) {
			var command = MemoryPackSerializer.Deserialize<C_ChatMessage>(rawCommand);
			EventManager.Fire(new OnServerReceivedChatMessage { Sender = client, Message = command.MessageText });
		}
	}
}
